package server;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class ActiveSessions {
	private Collection<ClientSession> sessionList 
			= new ArrayList<ClientSession>();
	/**
	 * Add session to active session's list.
	 * @param s Session to add
	 */
	public synchronized void addSession(ClientSession s) {
			sessionList.add(s);
			Server.log.println("Client entered: " + s, Server.conf.isConsole());
	}
	/**
	 * Get iterator for activesession's list.
	 * @return Iterator of sessionlist
	 */
	public Iterator<ClientSession> iterator() {
		return sessionList.iterator();
	}
	/**
	 * Get nr of active sessions.
	 * @return Nr of active sessions
	 */
	public int getActiveSessionsCount() {
		return sessionList.size();
	}
}
